package com.powernode.domain;

import java.math.BigDecimal;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author 付作巍
 * @since 2024-08-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("orders_list")
@ApiModel(value="Order对象", description="订单表")
public class OrdersList implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "订单ID")
    @TableId(value = "order_id", type = IdType.AUTO)
    @ExcelProperty("订单ID")
    private Long orderId;

    @ApiModelProperty(value = "订购用户ID")
    @ExcelProperty("订购用户ID")
    private String openId;

    @ApiModelProperty(value = "订购流水号")
    @ExcelProperty("订购流水号")
    private String orderNumber;

    @ApiModelProperty(value = "总值")
    @ExcelProperty("总值")
    private BigDecimal totalMoney;

    @ApiModelProperty(value = "实际总值")
    @ExcelProperty("实际总值")
    private BigDecimal actualTotal;

    @ApiModelProperty(value = "订单备注")
    @ExcelProperty("订单备注")
    private String remarks;

    @ApiModelProperty(value = "订单状态 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败")
    @ExcelProperty("订单状态 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败")
    private Integer status;

    @ApiModelProperty(value = "配送类型")
    @ExcelProperty("配送类型")
    private String dvyType;

    @ApiModelProperty(value = "配送方式ID")
    @ExcelProperty("配送方式ID")
    private Long dvyId;

    @ApiModelProperty(value = "物流单号")
    @ExcelProperty("物流单号")
    private String dvyFlowId;

    @ApiModelProperty(value = "订单运费")
    @ExcelProperty("订单运费")
    private BigDecimal freightAmount;

    @ApiModelProperty(value = "用户订单地址Id")
    @ExcelIgnore
    private Long addrOrderId;

    @ApiModelProperty(value = "订单商品总数")
    @ExcelProperty("订单商品总数")
    private Integer productNums;

    @ApiModelProperty(value = "订购时间")
    @ExcelProperty("订购时间")
    private Date createTime;

    @ApiModelProperty(value = "订单更新时间")
    @ExcelProperty("订单更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "付款时间")
    @ExcelProperty("付款时间")
    private Date payTime;

    @ApiModelProperty(value = "发货时间")
    @ExcelProperty("发货时间")
    private Date dvyTime;

    @ApiModelProperty(value = "完成时间")
    @ExcelProperty("完成时间")
    private Date finallyTime;

    @ApiModelProperty(value = "取消时间")
    @ExcelProperty("取消时间")
    private Date cancelTime;

    @ApiModelProperty(value = "是否已经支付，1：已经支付过，0：，没有支付过")
    @ExcelIgnore
    private Integer isPayed;

    @ApiModelProperty(value = "用户订单删除状态，0：没有删除， 1：回收站， 2：永久删除")
    @ExcelIgnore
    private Integer deleteStatus;

    @ApiModelProperty(value = "0:默认,1:在处理,2:处理完成")
    @ExcelProperty("0:默认,1:在处理,2:处理完成")
    private Integer refundSts;

    @ApiModelProperty(value = "优惠总额")
    @ExcelProperty("优惠总额")
    private BigDecimal reduceAmount;

    @ApiModelProperty(value = "订单关闭原因 1-超时未支付 2-退款关闭 4-买家取消 15-已通过货到付款交易")
    @ExcelProperty("订单关闭原因 1-超时未支付 2-退款关闭 4-买家取消 15-已通过货到付款交易")
    private Integer closeType;


    //////////////////////////////////
    @TableField(exist = false)
    @ExcelIgnore
    private List<OrderItem> orderItems;

    @TableField(exist = false)
    @ExcelIgnore
    private MemberAddr userAddrOrder;

    @TableField(exist = false)
    @ExcelIgnore
    private String nickName;    // 买家人姓名

    /////////////// 微信小程序会员订单列表 ////////////////////////
    @TableField(exist = false)
    @ExcelIgnore
    private List<OrderItem> orderItemDtos;

    @TableField(exist = false)
    @ExcelIgnore
    private MemberAddr userAddrDto;

}
